/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Juanan
 */
@Entity
@Table(name = "nod_node")
@NamedQueries(
{
    @NamedQuery(name = "NodNode.findAll", query = "SELECT n FROM NodNode n")
})
public class NodNode implements Serializable
{
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "NOD_ID")
    private Integer nodId;
    @Column(name = "NOD_CODE")
    private String nodCode;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "NOD_X")
    private BigDecimal nodX;
    @Column(name = "NOD_Y")
    private BigDecimal nodY;
    @Column(name = "NOD_Z")
    private BigDecimal nodZ;
    @Column(name = "NOD_IS_SOURCE")
    private Boolean nodIsSource;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "nodIdGroup")
    private Collection<TopTopology> topTopologyCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "nodId1")
    private Collection<TopTopology> topTopologyCollection1;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "nodId2")
    private Collection<TopTopology> topTopologyCollection2;

    public NodNode()
    {
    }

    public NodNode(Integer nodId)
    {
        this.nodId = nodId;
    }

    public Integer getNodId()
    {
        return nodId;
    }

    public void setNodId(Integer nodId)
    {
        this.nodId = nodId;
    }

    public String getNodCode()
    {
        return nodCode;
    }

    public void setNodCode(String nodCode)
    {
        this.nodCode = nodCode;
    }

    public BigDecimal getNodX()
    {
        return nodX;
    }

    public void setNodX(BigDecimal nodX)
    {
        this.nodX = nodX;
    }

    public BigDecimal getNodY()
    {
        return nodY;
    }

    public void setNodY(BigDecimal nodY)
    {
        this.nodY = nodY;
    }

    public BigDecimal getNodZ()
    {
        return nodZ;
    }

    public void setNodZ(BigDecimal nodZ)
    {
        this.nodZ = nodZ;
    }

    public Boolean getNodIsSource()
    {
        return nodIsSource;
    }

    public void setNodIsSource(Boolean nodIsSource)
    {
        this.nodIsSource = nodIsSource;
    }

    public Collection<TopTopology> getTopTopologyCollection()
    {
        return topTopologyCollection;
    }

    public void setTopTopologyCollection(Collection<TopTopology> topTopologyCollection)
    {
        this.topTopologyCollection = topTopologyCollection;
    }

    public Collection<TopTopology> getTopTopologyCollection1()
    {
        return topTopologyCollection1;
    }

    public void setTopTopologyCollection1(Collection<TopTopology> topTopologyCollection1)
    {
        this.topTopologyCollection1 = topTopologyCollection1;
    }

    public Collection<TopTopology> getTopTopologyCollection2()
    {
        return topTopologyCollection2;
    }

    public void setTopTopologyCollection2(Collection<TopTopology> topTopologyCollection2)
    {
        this.topTopologyCollection2 = topTopologyCollection2;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (nodId != null ? nodId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NodNode))
        {
            return false;
        }
        NodNode other = (NodNode) object;
        if ((this.nodId == null && other.nodId != null) || (this.nodId != null && !this.nodId.equals(other.nodId)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "entities.NodNode[ nodId=" + nodId + " ]";
    }
    
}
